package com.noble.glamour.third.share.data;

import com.noble.library.base.bean.BaseData;
import com.noble.glamour.third.share.util.ShareEnum;
import com.noble.glamour.third.share.util.ShareType;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * 分享肉容
 */
public class ShareData extends BaseData implements Serializable {
    private String id;
    private String title;//标题
    private String info; //内容
    private String img; //图片
    private String redirect;//跳转链接： 利用浏览器分享功能的分享链接； 复制到剪切板的分享链接；短信分享链接

    private ShareType shareType; //分享类型
    private ShareEnum shareEnum; //分享渠道

    public ShareData() {
    }

    public ShareData(String id, String title, String info, String img, String redirect) {
        this.setId(id);
        this.setTitle(title);
        this.setInfo(info);
        this.setImg(img);
        this.setRedirect(redirect);
    }

    public ShareData(String id, String title, String info, String img, String redirect, ShareType shareType, ShareEnum shareEnum) {
        this.setId(id);
        this.setTitle(title);
        this.setInfo(info);
        this.setImg(img);
        this.setRedirect(redirect);
        this.setShareType(shareType);
        this.setShareEnum(shareEnum);
    }

    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);
        this.setImg(jsonObject.optString("img"));
        this.setTitle(jsonObject.optString("title"));
        this.setInfo(jsonObject.optString("content"));
        this.setRedirect(jsonObject.optString("url"));
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getRedirect() {
        return redirect;
    }

    public void setRedirect(String redirect) {
        this.redirect = redirect;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public ShareType getShareType() {
        return shareType;
    }

    public void setShareType(ShareType shareType) {
        this.shareType = shareType;
    }

    public ShareEnum getShareEnum() {
        return shareEnum;
    }

    public void setShareEnum(ShareEnum shareEnum) {
        this.shareEnum = shareEnum;
    }
}
